public class Solution367 {
    public boolean isPerfectSquare(int num) {
        int l=1,r=46340;
        while (l<=r){
            int mid=(l+r)/2;
            if (mid*mid==num){
                return true;
            }
            if (mid*mid<num){
                l=mid+1;
            }else{
                r=mid-1;
            }
        }
        return false;
    }

    public static void main(String[] args) {
        System.out.println(new Solution367().isPerfectSquare(14));
    }
}
